package com.school.service;

import com.school.dao.OrdersDAO;
import com.school.entity.Orders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrdersService {
    @Autowired
    private OrdersDAO dao;

    @Override
    public String toString() {
        return "OrdersService{" +
                "dao=" + dao +
                '}';
    }

    public OrdersService() {
        System.out.println("OrdersService创建！");
    }

    public Orders[] selectAll(String user_phone) {
        return dao.selectAll(user_phone);
    }

    public int insertOne(Orders orders) {
        int i = 0;
        try {
            i = dao.insertOne(orders);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return i;
    }

    public int updateOne(Orders orders) {
        int i = 0;
        try {
            i = dao.updateOne(orders);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return i;
    }

    public int deleteOne(String  ticketid) {
        int i = 0;
        try {
            i = dao.deleteOne(ticketid);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return i;
    }

}
